// SafeLink.h: interface for the CSafeLink class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SAFELINK_H__F9FEEDC0_2A49_11D4_A043_0080AD315721__INCLUDED_)
#define AFX_SAFELINK_H__F9FEEDC0_2A49_11D4_A043_0080AD315721__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CGameLink  
{
public:
    BOOL ConnectServer(LPCSTR szServerName,HWND hMainWnd);
    int SendCmd(BYTE cCmdID, LPCSTR buf, int nLen);
    int RecvCmd(BYTE& cCmdID, char *buf, int& nLen);
    void CloseConnect();
    BOOL IsConnectOK();

    CGameLink();
    virtual ~CGameLink();

private:
    HANDLE		m_hLink;
    static	int m_nReferenceCount;
};

class CSafeLink  
{
public:
    BOOL ConnectServer(LPCSTR szServerName,HWND hMainWnd);
    int SendCmd(BYTE cCmdID, LPCSTR buf, int nLen);
    int RecvCmd(BYTE& cCmdID, char *buf, int& nLen);
    void CloseConnect();
    BOOL IsConnectOK();
    CSafeLink();
    virtual ~CSafeLink();

private:
    CGameLink	m_link;
    WORD		m_wSendKey;
    WORD		m_wRecvKey;
    WORD		SeedMap(WORD wSeed);
};

#endif // !defined(AFX_SAFELINK_H__F9FEEDC0_2A49_11D4_A043_0080AD315721__INCLUDED_)
